package only.my.railgunys.preparation;

import only.my.railgunys.bean.db.Artifact;
import only.my.railgunys.bean.db.PossibleFinalForm;
import only.my.railgunys.repository.ArtifactRepository;
import only.my.railgunys.repository.PossibleFinalFormRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.*;
import java.util.stream.Collectors;

@Component
public class BuildUp {
    @Autowired
    ArtifactRepository artifactRepository;
    @Autowired
    PossibleFinalFormRepository possibleFinalFormRepository;

    List<Artifact> all;

    @PostConstruct
    public void init() {
        Artifact artifact = new Artifact();
        artifact.setLevel(1);
        Example<Artifact> artifactExample = Example.of(artifact);
        all = artifactRepository.findAll(artifactExample);


    }

    /**
     * 攻双爆词条数
     *
     * @param possibleFinalForm
     * @return
     */
    public double accValue(PossibleFinalForm possibleFinalForm) {
        double atkv = possibleFinalForm.getPercentATK() / 5.8;
        double cdv = possibleFinalForm.getCritDamage() / 5.4;
        double crv = possibleFinalForm.getCritRate() / 2.7;

        return atkv + cdv + crv;
    }

}
